home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 May / com_0505_1.iso / opensource / top10 / amc_install.exe / {app} / Scripts / Friends-forum.com (RU) (pic).ifs < prev    next >
Encoding:
Text File  |  2005-01-28  |  6.6 KB  |  184 lines

  1. // GETINFO SCRIPTING
  2. // Imports movies info (RU) with picture from Friends-Forum.com
  3. //    (±) Ilya 2005
  4. program FriendsForum;
  5. const
  6.   BaseAddress = 'http://www.friends-forum.com/';
  7. var
  8.   MovieName: string;
  9.  
  10. function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
  11. var
  12.   i: Integer;
  13. begin
  14.   result := -1;
  15.   if StartAt < 0 then
  16.     StartAt := 0;
  17.   for i := StartAt to List.Count-1 do
  18.     if Pos(Pattern, List.GetString(i)) <> 0 then
  19.     begin
  20.       result := i;
  21.       Break;
  22.     end;
  23. end;
  24.  
  25. procedure AnalyzePage(Address: string);                  //╧εΦ±Ω ⌠Φδⁿ∞εΓ Φ ⌠ε≡∞Φ≡εΓαφΦσ ±∩Φ±Ωα
  26. var
  27.   ID, FilmName, Line: String;
  28.   Page: TStringList;
  29.   FilmPage: TStringList;
  30.   BeginPos, EndPos, Lines: Integer;
  31. begin
  32.   Page := TStringList.Create;
  33.   Page.Text := GetPage(Address);
  34.   BeginPos := FindLine('<TH  bgcolor="#FF9900"><font class=A_white>╬ ╘Φδⁿ∞σ</font></TH></tr>', Page,0);
  35.   EndPos := FindLine('ΣεßαΓΦ≥ⁿ Γ ∞εΘ Ωα≥αδεπ', Page,0);
  36.   if  BeginPos> 0 then
  37.     begin
  38.       Line:='';
  39.       for Lines := BeginPos+1 to EndPos do            //╧εδ≤≈σφΦσ ±≥≡εΩ ± φατΓαφΦ ∞Φ Φ αΣ≡σ±α∞Φ
  40.         Line:=Line+Page.GetString(Lines);
  41.       PickTreeClear;                                  //╬≈Φ±≥Ωα Σσ≡σΓα ⌠Φδⁿ∞εΓ
  42.       PickTreeAdd('╧εΦ±Ω ∩ε ±δεΓ≤: ' + MovieName, '');
  43.       repeat
  44.       BeginPos := Pos('<td align=center><A HREF="modules.php?name=Movie_News&file=preview&id',Line);
  45.       If BeginPos>0 Then
  46.       Begin
  47.         Delete(Line,1,BeginPos);                      //╙ΣαδσφΦσ φα≈αδα
  48.         BeginPos:=26;
  49.         EndPos := Pos('"><center><b>',Line);
  50.         ID := copy(Line, BeginPos, EndPos - BeginPos); //╧εδ≤≈Φ≥ⁿ αΣ≡σ± ±≥≡αφΦ÷√ ⌠Φδⁿ∞α
  51.         BeginPos := Pos('"><center><b>',Line)+12;
  52.         Delete(Line,1,BeginPos);
  53.         BeginPos := 1;
  54.         EndPos := Pos('</b></A><br>',Line)-1;
  55.         FilmName := Copy(Line, BeginPos, EndPos);       //╧εδ≤≈Φ≥ⁿ φατΓαφΦσ ⌠Φδⁿ∞α
  56.         FilmName := StringReplace(FilmName,' ',' ');
  57.         PickTreeAdd(FilmName, BaseAddress + ID);
  58.       end;
  59.       until BeginPos < 1;
  60.     end;
  61.   If  PickTreeExec(Address) Then
  62.       AnalyzeMoviePage(Address);
  63. end;
  64.  
  65. procedure AnalyzeMoviePage(Address: String);        //╧εδ≤≈σφΦσ Φφ⌠ε≡∞α÷ΦΦ ε Γ√ß≡αφε∞ ⌠Φδⁿ∞σ
  66. var
  67.   Page: TStringList;
  68.   LineNr : Integer;
  69.   Line, Value : String;
  70.   BeginPos, EndPos : Integer;
  71.  
  72. begin
  73.   Page := TStringList.Create;
  74.   Page.Text := GetPage(Address);
  75.  
  76.   SetField(fieldURL,Address);                         //╧εδ≤≈σφΦσ URL
  77.  
  78.  
  79.   BeginPos := FindLine('> » ╚φ⌠ε≡∞α÷Φ  ε ⌠Φδⁿ∞σ', Page,0);
  80.   EndPos := FindLine('╨σΘ≥Φφπ ∩εδⁿτεΓα≥σδσΘ</a>:</B>', Page,0);
  81.  
  82.    Line:='';
  83.       for LineNr := BeginPos to EndPos do             //╧εδ≤≈Φ≥ⁿ ±≥≡εΩΦ ± Φφ⌠ε≡∞α÷ΦσΘ
  84.         Line:=Line+Page.GetString(LineNr);
  85.  
  86.     Value := '';                                               //Φ∞∩ε≡≥ Ωα≡≥ΦφΩΦ
  87.     BeginPos := Pos('<IMG SRC="',Line)+10;
  88.     Delete(Line,1,BeginPos);
  89.     BeginPos :=1;
  90.     EndPos := pos('">', Line);
  91.     if copy(Line, BeginPos, 1) = '/' then
  92.          Value := 'http://www.friends-forum.com/';
  93.     Value := Value + copy(Line, BeginPos, EndPos - BeginPos);
  94.     GetPicture(Value, False);
  95.  
  96.     BeginPos := Pos('<B>═ατΓαφΦσ:</B>',Line)+16;               //∩σ≡σΓσΣσφφεσ φατΓαφΦσ
  97.     Delete(Line,1,BeginPos);
  98.     BeginPos :=1;
  99.     EndPos := Pos('     </TD></TR>',Line);
  100.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  101.     SetField(fieldTranslatedTitle,Value);
  102.  
  103.     BeginPos := pos('╬≡ΦπΦφαδⁿφεσ φατΓαφΦσ', Line)+26;          //ε≡ΦπΦφαδⁿφεσ φατΓαφΦσ
  104.     Delete(Line,1,BeginPos);
  105.     BeginPos :=1;
  106.     EndPos := Pos('     </TD></TR>',Line);;
  107.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  108.     SetField(fieldOriginalTitle, Value);
  109.  
  110.     BeginPos := pos('Γ√⌡εΣα', Line)+10;                          //πεΣ
  111.     Delete(Line,1,BeginPos);
  112.     BeginPos :=1;
  113.     EndPos := BeginPos+5;
  114.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  115.     SetField(fieldYear, Value);
  116.  
  117.     BeginPos := pos('╞αφ≡', Line)+9;                             //µαφ≡
  118.     Delete(Line,1,BeginPos);
  119.     BeginPos :=1;
  120.     EndPos := Pos('     </TD></TR>',Line);
  121.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  122.     SetField(fieldCategory, Value);
  123.  
  124.     BeginPos := pos('╨σµΦ±±σ≡', Line)+13;                         //≡σµΦ±±σ≡
  125.     Delete(Line,1,BeginPos);
  126.     BeginPos :=1;
  127.     EndPos := Pos('     </TD></TR>',Line);
  128.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  129.     SetField(fieldDirector, Value);
  130.  
  131.     BeginPos := pos('≡εδ ⌡', Line)+10;                             //Γ ≡εδ ⌡
  132.     Delete(Line,1,BeginPos);
  133.     BeginPos :=1;
  134.     EndPos := Pos('     </TD></TR>',Line);
  135.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  136.     SetField(fieldActors, Value);
  137.  
  138.     BeginPos := pos('⌠Φδⁿ∞σ', Line)+11;                             //╬ ⌠Φδⁿ∞σ
  139.     Delete(Line,1,BeginPos);
  140.     BeginPos :=1;
  141.     EndPos := Pos('     </TD></TR>',Line);
  142.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  143.     SetField(fieldDescription,Value);
  144.  
  145.     BeginPos := pos('┬√∩≤∙σφε', Line)+13;                            //±≥≤ΣΦ  (∩≡εΣ■±σ≡)
  146.     Delete(Line,1,BeginPos);
  147.     BeginPos :=1;
  148.     EndPos := Pos('     </TD></TR>',Line);
  149.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  150.     SetField(fieldProducer, Value);
  151.  
  152.     BeginPos := pos('▀τ√Ω', Line)+9;                                  // τ√Ω
  153.     Delete(Line,1,BeginPos);
  154.     BeginPos :=1;
  155.     EndPos := Pos('     </TD></TR>',Line);
  156.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  157.     SetField(fieldLanguages, Value);
  158.     
  159.     BeginPos := pos('╧≡Φ∞σ≈αφΦ ', Line)+15;                            //Ωε∞σφ≥α≡ΦΦ
  160.     Delete(Line,1,BeginPos);
  161.     BeginPos :=1;
  162.     EndPos := Pos('</td></tr>',Line);
  163.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  164.     SetField(fieldComments, Value);
  165.  
  166.     BeginPos := Pos('╨σΘ≥Φφπ ∩εδⁿτεΓα≥σδσΘ</a>:</B>',Line)+31;       //≡σΘ≥Φφπ (Ωα≈σ±≥Γε)
  167.     EndPos := Pos(' / 10 (',Line);
  168.     Value := copy(Line, BeginPos, EndPos - BeginPos);
  169.     Value := Trim(Left(StringReplace(Value, '.', '   '),2));
  170.     Value := IntToStr(StrToInt(Value,0));
  171.     SetField(fieldRating,Value);
  172.  
  173. DisplayResults;
  174. end;
  175.  
  176.  
  177. begin
  178.     MovieName := GetField(fieldOriginalTitle);
  179.     if MovieName = '' then
  180.       MovieName := GetField(fieldTranslatedTitle);
  181.     if Input('╧εΦ±Ω φα Friends-Forum.com', '┬ΓσΣΦ≥σ φατΓαφΦσ ⌠Φδⁿ∞α:', MovieName) then
  182.       AnalyzePage('http://www.friends-forum.com/modules.php?name=Movie_News&file=index&orderfield=&direct=&pagenum=&searchterm='+UrlEncode(MovieName)+'&category=%C2%F1%E5&vlang=&let=&rezhiser=&artist=&format=%C2%F1%E5&kachestvo=%C2%F1%E5&storynum=100');
  183. end.
  184.